#pragma once
#include"Red_Black_Tree.h"



namespace MyMap  
{

	template <class k, class v> 
	class map 
	{  

		class extract
		{
		public:
			k operator()(const pair<k, v>& kv)   
			{
				return kv.first;  
			}
		};

	public:

		typedef typename RBTree<pair<const k, v>,const k, extract>::iterator iterator;               
		typedef typename RBTree<pair<const k, v>, const k, extract>::const_iterator const_iterator;    
		RBTree<pair<const k, v>, const k, extract> _m;
		   
	
		v& operator[](const k& kv)
		{
			pair<iterator, bool> ret = Insert(make_pair(kv, v()));

			return (ret.first)->second;
		}

		bool Finc(const k& k)
		{
			return _m.Find(k).second;
		}

		iterator begin()
		{
			return _m.begin();
		}

		iterator end()
		{
			return _m.end();  
		}
		
		const_iterator begin() const 
		{
			return _m.begin();      
		}

		const_iterator end() const 
		{
			return _m.end();        
		}

		pair<iterator, bool> Insert(const pair<const k, v>& key)   
		{
			return _m.Insert(key);
		}

	

	};

}